{
 "cells": [
  {
   "cell_type": "markdown",
   "id": "aa1f8be6-a0a1-4842-a79f-7eb8cf34c4f9",
   "metadata": {},
   "source": [
    "# LeadFormer: 北极海冰高分辨率智能预报¶\n",
    "\n",
    "## 概述\n",
    "\n",
    "冰间水道是海冰在海浪、风力和洋流作用下形成的线状断裂带，其形态特征能够反映海洋与大气之间物质能量交换的强度，影响着水道表面的湍流热通量。因此，冰间水道的形态及空间分布的准确刻画对研究北极的海冰变化和预测航道通航具有重要意义。冰间水道的形态特征包括长度、宽度和倾角等。冰间水道宽度在一定程度上决定了大气和海洋水热交换的强度，水道倾角反应且影响海冰动力学特征，水道总长度可以作为衡量冰间水道尺度变异及季节和年际变化的指标。高分辨率海冰冰间水道预测模型是当前应对全球气候变暖背景下北极海冰快速变化的关键技术工具。针对海冰变化机理的复杂性和海冰预报的不确定性，***LeadFormer***以北极高分辨率数值模式数据和基于transformer的人工智能模型为支撑，实现北极冰间水道的智能预报，区域覆盖泛北极，分辨率达到2km的高分辨率冰情预报体系。\n",
    "\n",
    "![LeadFormer](images/model.png)\n",
    "\n",
    "该模型采用编码器-解码器框架，编码阶段通过重叠块嵌入和四级Transformer块实现特征压缩与深化；解码阶段通过MLP和上采样操作逐步重建空间维度；核心创新在于融合Transformer的全局建模能力与CNN的局部感知特性，适用于高精度图像处理任务。\n",
    "\n",
    "本模型数据集暂不开源，仅开源代码。"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "ad6f6a1a-8fc9-4202-b6c4-5521f0b76834",
   "metadata": {},
   "source": [
    "## 概述\n",
    "\n",
    "MindEarth求解该问题的具体流程如下:\n",
    "\n",
    "1.模型构建\n",
    "\n",
    "2.模型训练\n",
    "\n",
    "3.模型评估与可视化\n",
    "\n",
    "本模型数据集暂不开源，仅开源代码。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "76482de7-2f70-4176-8cc2-ac411d95fce5",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[WARNING] ME(1012809:281472904290336,MainProcess):2025-08-07-15:36:02.292.000 [mindspore/run_check/_check_version.py:402] Can not find the tbe operator implementation(need by mindspore-ascend). Please check whether the Environment Variable PYTHONPATH is set. For details, refer to the installation guidelines: https://www.mindspore.cn/install\n"
     ]
    }
   ],
   "source": [
    "import mindspore as ms\n",
    "from mindspore import set_seed, context"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "0a61d243-a38d-406d-b24b-f310d2e083a4",
   "metadata": {},
   "source": [
    "下述src可以在[LeadFormer/src](./src)下载。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "92350b28-3bf3-4cc3-a120-ad3ba0cde982",
   "metadata": {},
   "outputs": [],
   "source": [
    "from mindearth.utils import load_yaml_config\n",
    "\n",
    "from src.solver import Trainer\n",
    "from src.forecast import Tester"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 3,
   "id": "758ef133-7955-438b-acfb-dcad8858ab45",
   "metadata": {},
   "outputs": [],
   "source": [
    "set_seed(0)"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "d54b33c2-1572-48c0-8300-75a3d96c549c",
   "metadata": {},
   "source": [
    "可以在[配置文件](./configs/2km_ice_config.yaml)中配置模型、数据和优化器等参数。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 4,
   "id": "6857d73b-358d-4e85-818e-7fa5f089a84f",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[WARNING] ME(1012809:281472904290336,MainProcess):2025-08-07-15:36:09.777.000 [mindspore/run_check/_check_version.py:402] Can not find the tbe operator implementation(need by mindspore-ascend). Please check whether the Environment Variable PYTHONPATH is set. For details, refer to the installation guidelines: https://www.mindspore.cn/install\n"
     ]
    }
   ],
   "source": [
    "context.set_context(mode=ms.PYNATIVE_MODE)\n",
    "ms.set_device(device_target=\"Ascend\", device_id=4)\n",
    "config = load_yaml_config(\"./configs/2km_ice_config.yaml\")"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "eb526cde-3ea4-4050-8fe1-45f6b2d14eca",
   "metadata": {},
   "source": [
    "## 模型训练\n",
    "\n",
    "在本教程中，我们使用Trainer对模型进行训练。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": 6,
   "id": "668a976d-ffdd-4807-b90a-e1baefcb783e",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[WARNING] ME(3419713:281473115082784,MainProcess):2025-08-07-10:56:00.474.000 [mindspore/dataset/core/config.py:685] The shared memory is on, multiprocessing performance will be improved. Note: the required shared memory can't exceeds 80% of the available shared memory.\n",
      "[WARNING] ME(3419713:281473115082784,MainProcess):2025-08-07-10:56:01.280.00 [mindspore/run_check/_check_version.py:305] The version 7.6 used for compiling the custom operator does not match Ascend AI software package version 7.5 in the current environment.\n",
      "[WARNING] ME(3419713:281473115082784,MainProcess):2025-08-07-10:56:01.330.00 [mindspore/train/model.py:1419] For StepLossTimeMonitor callback, {'step_begin', 'epoch_end', 'step_end', 'epoch_begin'} methods may not be supported in later version, Use methods prefixed with 'on_train' or 'on_eval' instead when using customized callbacks.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "============== Starting Training ==============\n",
      "==============================================================\n",
      ".............step: 1, loss is 0.2585278, fps is 0.007067410267447278, lr is 1e-04\n",
      "step: 2, loss is 1.3312725, fps is 0.18855858711971155, lr is 1e-04\n",
      "step: 3, loss is 0.39229235, fps is 0.27716471662093956, lr is 1e-04\n",
      "step: 4, loss is 0.34179375, fps is 0.3300149329982123, lr is 1e-04\n",
      "step: 5, loss is 0.4487785, fps is 0.3321377820521602, lr is 1e-04\n",
      "step: 6, loss is 0.17796662, fps is 0.28678993865574326, lr is 1e-04\n",
      "step: 7, loss is 0.17500843, fps is 0.2804825260482442, lr is 1e-04\n",
      "step: 8, loss is 0.1605135, fps is 0.32581367309958326, lr is 1e-04\n",
      "step: 9, loss is 0.1647645, fps is 0.27461646180829363, lr is 1e-04\n",
      "epoch:   1, avg loss:0.3834, total cost: 176.468 s, per step fps:0.051\n",
      "step: 1, loss is 0.19449174, fps is 0.4835091969602687, lr is 9.9726094e-05\n",
      "step: 2, loss is 0.07440963, fps is 0.4702539411465023, lr is 9.9726094e-05\n",
      "step: 3, loss is 0.27065408, fps is 0.46883899778116844, lr is 9.9726094e-05\n",
      "step: 4, loss is 0.09641305, fps is 0.47306889037293376, lr is 9.9726094e-05\n",
      "step: 5, loss is 0.15553927, fps is 0.4792626517483649, lr is 9.9726094e-05\n",
      "step: 6, loss is 0.13678743, fps is 0.47240835108772194, lr is 9.9726094e-05\n",
      "step: 7, loss is 0.18045919, fps is 0.4727445974472515, lr is 9.9726094e-05\n",
      "step: 8, loss is 0.121810436, fps is 0.4675605187249209, lr is 9.9726094e-05\n",
      "step: 9, loss is 0.098566085, fps is 0.46855810855662056, lr is 9.9726094e-05\n",
      "epoch:   2, avg loss:0.1477, total cost: 20.548 s, per step fps:0.438\n",
      "step: 1, loss is 0.19244102, fps is 0.46974691839125243, lr is 9.890738e-05\n",
      "step: 2, loss is 0.15396605, fps is 0.47269851165984045, lr is 9.890738e-05\n",
      "step: 3, loss is 0.21747951, fps is 0.47871531890983626, lr is 9.890738e-05\n",
      "step: 4, loss is 0.22973962, fps is 0.4678759613964494, lr is 9.890738e-05\n",
      "step: 5, loss is 0.14149912, fps is 0.4686135474245217, lr is 9.890738e-05\n",
      "step: 6, loss is 0.13367249, fps is 0.4676195275534368, lr is 9.890738e-05\n",
      "step: 7, loss is 0.10203815, fps is 0.46257949112665014, lr is 9.890738e-05\n",
      "step: 8, loss is 0.13874854, fps is 0.468793670291153, lr is 9.890738e-05\n",
      "step: 9, loss is 0.181213, fps is 0.4711711134851441, lr is 9.890738e-05\n",
      "epoch:   3, avg loss:0.1656, total cost: 20.472 s, per step fps:0.440\n",
      "step: 1, loss is 0.23165968, fps is 0.4659994491516903, lr is 9.7552824e-05\n",
      "step: 2, loss is 0.072046176, fps is 0.4671766475833158, lr is 9.7552824e-05\n",
      "step: 3, loss is 0.23098187, fps is 0.47607396613513847, lr is 9.7552824e-05\n",
      "step: 4, loss is 0.17709546, fps is 0.4714999288417208, lr is 9.7552824e-05\n",
      "step: 5, loss is 0.13153948, fps is 0.47837914901673634, lr is 9.7552824e-05\n",
      "step: 6, loss is 0.10806603, fps is 0.46920408551603504, lr is 9.7552824e-05\n",
      "step: 7, loss is 0.2324798, fps is 0.4703840462320135, lr is 9.7552824e-05\n",
      "step: 8, loss is 0.20180652, fps is 0.47566892757473156, lr is 9.7552824e-05\n",
      "step: 9, loss is 0.17364886, fps is 0.4421808711280614, lr is 9.7552824e-05\n",
      "......\n",
      "epoch:  28, avg loss:0.1316, total cost: 20.141 s, per step fps:0.447\n",
      "step: 1, loss is 0.096311785, fps is 0.48387031277398873, lr is 1.09262e-06\n",
      "step: 2, loss is 0.1910012, fps is 0.4785059284686627, lr is 1.09262e-06\n",
      "step: 3, loss is 0.09300855, fps is 0.4757382027972377, lr is 1.09262e-06\n",
      "step: 4, loss is 0.06182714, fps is 0.4843480540296477, lr is 1.09262e-06\n",
      "step: 5, loss is 0.1028601, fps is 0.4660128072014537, lr is 1.09262e-06\n",
      "step: 6, loss is 0.0648559, fps is 0.4695110811807986, lr is 1.09262e-06\n",
      "step: 7, loss is 0.2138748, fps is 0.4715329522445039, lr is 1.09262e-06\n",
      "step: 8, loss is 0.18132131, fps is 0.4756527446825787, lr is 1.09262e-06\n",
      "step: 9, loss is 0.070166126, fps is 0.4750834309048936, lr is 1.09262e-06\n",
      "epoch:  29, avg loss:0.1195, total cost: 20.285 s, per step fps:0.444\n",
      "step: 1, loss is 0.16265991, fps is 0.4689126933090539, lr is 2.7390524e-07\n",
      "step: 2, loss is 0.06894889, fps is 0.46606837040793697, lr is 2.7390524e-07\n",
      "step: 3, loss is 0.13682221, fps is 0.468522307987637, lr is 2.7390524e-07\n",
      "step: 4, loss is 0.14170526, fps is 0.47180951256070847, lr is 2.7390524e-07\n",
      "step: 5, loss is 0.07896267, fps is 0.47122563713087756, lr is 2.7390524e-07\n",
      "step: 6, loss is 0.106654026, fps is 0.4698092168453713, lr is 2.7390524e-07\n",
      "step: 7, loss is 0.1188283, fps is 0.4782360775717037, lr is 2.7390524e-07\n",
      "step: 8, loss is 0.146635, fps is 0.46966906855383656, lr is 2.7390524e-07\n",
      "step: 9, loss is 0.20011184, fps is 0.46569113259110906, lr is 2.7390524e-07\n",
      "epoch:  30, avg loss:0.1290, total cost: 20.339 s, per step fps:0.442\n",
      "============== End Training ==============\n"
     ]
    }
   ],
   "source": [
    "epoch_size = config[\"train\"].get(\"epochs\", 300)\n",
    "trainer = Trainer(config, epochs=epoch_size)\n",
    "trainer.train()"
   ]
  },
  {
   "cell_type": "markdown",
   "id": "19ade00d-8f02-4d2e-815f-05af82875883",
   "metadata": {},
   "source": [
    "## 模型评估\n",
    "\n",
    "完成训练后，我们使用第30个epoch的权重进行推理。下述展示了预测值与实际值之间的误差和各项指标。"
   ]
  },
  {
   "cell_type": "code",
   "execution_count": null,
   "id": "5c8d5f01-7dcc-46ff-933d-0f3ce82775ad",
   "metadata": {},
   "outputs": [
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "[WARNING] ME(1012809:281472904290336,MainProcess):2025-08-07-15:36:31.412.000 [mindspore/train/serialization.py:1956] For 'load_param_into_net', remove parameter prefix name: model., continue to load.\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "==================================================\n",
      "Missing keys: []\n",
      "Checkpoint loaded successfully!\n",
      "==================================================\n",
      "Total Parameters: 14214275\n",
      "Test dataset size: 1\n",
      ".ice_input_20170109.npy RMSE: 0.06927543270552072\n",
      "Average RMSE: 0.06927543270552072\n",
      "Maximum RMSE: 0.06927543270552072\n",
      "Start evaluate!\n",
      "ice_input_20170107.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170102.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170101.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170106.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170108.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170103.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170109.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170104.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170105.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170110.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170107.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170102.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170101.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170106.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170108.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170103.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170109.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170104.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170105.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n",
      "ice_input_20170110.npy\n",
      "========================================= break ==================================================\n",
      "========================================= break ==================================================\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1212/1212 [08:57<00:00,  2.26it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "247.6625131308501 0.0 21.980495081736816\n",
      "detect_result_ice_input_20170108.npy dis width is:  1.3631642412525773\n",
      "detect_result_ice_input_20170108.npy dis diff is:  0.1042636932498877\n",
      "detect_result_ice_input_20170108.npy degree diff is:  4.717008703899891\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1372/1372 [10:26<00:00,  2.19it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "289.4160607063347 0.0 27.346576883106486\n",
      "detect_result_ice_input_20170104.npy dis width is:  0.9752119597121295\n",
      "detect_result_ice_input_20170104.npy dis diff is:  0.10289706432384488\n",
      "detect_result_ice_input_20170104.npy degree diff is:  6.996797847345313\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1381/1381 [08:49<00:00,  2.61it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "311.4264251066365 0.0 23.031132891707415\n",
      "detect_result_ice_input_20170103.npy dis width is:  1.10339485188626\n",
      "detect_result_ice_input_20170103.npy dis diff is:  0.0864150463915106\n",
      "detect_result_ice_input_20170103.npy degree diff is:  6.265153611048445\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1303/1303 [11:06<00:00,  1.96it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "256.20677516485057 0.0 21.702993657408058\n",
      "detect_result_ice_input_20170110.npy dis width is:  1.1094030108893287\n",
      "detect_result_ice_input_20170110.npy dis diff is:  0.08734691066267006\n",
      "detect_result_ice_input_20170110.npy degree diff is:  5.833586445174906\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1302/1302 [10:10<00:00,  2.13it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "239.01588616995642 0.0 19.85132109877317\n",
      "detect_result_ice_input_20170107.npy dis width is:  1.165828382806233\n",
      "detect_result_ice_input_20170107.npy dis diff is:  0.08832406718394695\n",
      "detect_result_ice_input_20170107.npy degree diff is:  6.283825075937445\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1301/1301 [11:51<00:00,  1.83it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "215.84032367222633 0.0 21.73022214705445\n",
      "detect_result_ice_input_20170106.npy dis width is:  0.9514659075975823\n",
      "detect_result_ice_input_20170106.npy dis diff is:  0.14328743272156802\n",
      "detect_result_ice_input_20170106.npy degree diff is:  7.559965475096256\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1291/1291 [08:31<00:00,  2.52it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "346.3092233456352 0.0 29.625454195807148\n",
      "detect_result_ice_input_20170109.npy dis width is:  0.9989966988881656\n",
      "detect_result_ice_input_20170109.npy dis diff is:  0.10743155439241363\n",
      "detect_result_ice_input_20170109.npy degree diff is:  6.83757206490284\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1309/1309 [08:40<00:00,  2.51it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "941.0408776799075 0.0 24.629606081423983\n",
      "detect_result_ice_input_20170101.npy dis width is:  0.9382144248848047\n",
      "detect_result_ice_input_20170101.npy dis diff is:  0.09824832831725389\n",
      "detect_result_ice_input_20170101.npy degree diff is:  5.501169243719244\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1328/1328 [08:24<00:00,  2.63it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "335.33248763098686 0.0 33.43748652203445\n",
      "detect_result_ice_input_20170102.npy dis width is:  1.3782899260505495\n",
      "detect_result_ice_input_20170102.npy dis diff is:  0.09245287652421691\n",
      "detect_result_ice_input_20170102.npy degree diff is:  6.778529156282445\n"
     ]
    },
    {
     "name": "stderr",
     "output_type": "stream",
     "text": [
      "100%|█████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████████| 1359/1359 [12:32<00:00,  1.81it/s]\n",
      "/tmp/ipykernel_1012809/934503037.py:629: RuntimeWarning: All-NaN slice encountered\n",
      "  disnrst = np.nanmin(dismin, axis=0)\n"
     ]
    },
    {
     "name": "stdout",
     "output_type": "stream",
     "text": [
      "485.3900802751177 0.0 20.469466739220614\n",
      "detect_result_ice_input_20170105.npy dis width is:  2.167959851413929\n",
      "detect_result_ice_input_20170105.npy dis diff is:  0.0741817919181337\n",
      "detect_result_ice_input_20170105.npy degree diff is:  5.95075356676178\n",
      "avg diff width:  1.215192925538156\n",
      "avg diff dis:  0.09848487656854464\n",
      "avg diff degree:  6.272436119016858\n",
      "max diff width:  2.167959851413929\n",
      "max diff dis:  0.14328743272156802\n",
      "max diff degree:  7.559965475096256\n",
      "acc for  detect_result_ice_input_20170108.npy  is: 0.98944425\n",
      "acc for  detect_result_ice_input_20170104.npy  is: 0.98901625\n",
      "acc for  detect_result_ice_input_20170103.npy  is: 0.98956825\n",
      "acc for  detect_result_ice_input_20170110.npy  is: 0.98920175\n",
      "acc for  detect_result_ice_input_20170107.npy  is: 0.989827\n",
      "acc for  detect_result_ice_input_20170106.npy  is: 0.988562\n",
      "acc for  detect_result_ice_input_20170109.npy  is: 0.989696\n",
      "acc for  detect_result_ice_input_20170101.npy  is: 0.9889415\n",
      "acc for  detect_result_ice_input_20170102.npy  is: 0.9892355\n",
      "acc for  detect_result_ice_input_20170105.npy  is: 0.9891005\n",
      "avg acc is:  0.9892593\n",
      "Evaluation completed!\n"
     ]
    }
   ],
   "source": [
    "evaluator = Tester(config)\n",
    "evaluator.evaluate()"
   ]
  }
 ],
 "metadata": {
  "kernelspec": {
   "display_name": "Python 3 (ipykernel)",
   "language": "python",
   "name": "python3"
  },
  "language_info": {
   "codemirror_mode": {
    "name": "ipython",
    "version": 3
   },
   "file_extension": ".py",
   "mimetype": "text/x-python",
   "name": "python",
   "nbconvert_exporter": "python",
   "pygments_lexer": "ipython3",
   "version": "3.11.11"
  }
 },
 "nbformat": 4,
 "nbformat_minor": 5
}
